package com.six.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.six.pojo.BillManage;
import com.six.result.Result;
import com.six.result.ResultUtils;
import com.six.service.BillManageService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "发票管理接口文档")
@RestController
@RequestMapping("/billManage")
@Slf4j
@CrossOrigin
public class BillManageController {

    @Autowired
    private BillManageService billManageService;

    @PostMapping("/list")
    public Result findList(){
        return null;
    }

    @PostMapping("/add")
    public Result add(@RequestBody BillManage billManage){
        //TODO 前端给后台发送一个dto对象，
        // 包括一个采购合同对象和一个合同列表对象，
        // 后台成功添加采购合同对象后再循环添加列表对象，
        // 放到一个事务中
        return ResultUtils.buildSuccess();
    }

    @PutMapping("/update")
    public Result update(@RequestBody BillManage billManage){
        billManageService.updateById(billManage);
        return ResultUtils.buildSuccess();
    }

    @DeleteMapping("/delete/{id}")
    public Result deleteById(@PathVariable Long id){
        // TODO 删除发票管理时要同时删除发票详细信息
        return ResultUtils.buildSuccess();
    }

}
